package com.example.moshudriver.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.sgr.dykdriver.R;

//订单列表，不用
public class OrderListActivity extends Activity {
	private ListView my_travle_list;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.my_order_list);
		initView();

	}

	private void initView() {
		my_travle_list = (ListView) findViewById(R.id.my_travle_list);
		MyAdapter adapter = new MyAdapter();
		my_travle_list.setAdapter(adapter);

	}

	public class MyAdapter extends BaseAdapter {

		private ImageView iv_price_reduce;
		private ImageView iv_price_plus;
		private TextView tv_price;
		private Integer price = 15;

		public int getCount() {
			// TODO Auto-generated method stub
			return 3;
		}

		public Object getItem(int arg0) {
			// TODO Auto-generated method stub
			return null;
		}

		public long getItemId(int arg0) {
			// TODO Auto-generated method stub
			return 0;
		}

		public View getView(int arg0, View arg1, ViewGroup arg2) {
			// TODO Auto-generated method stub
			final View view = View.inflate(getApplicationContext(),
					R.layout.my_order_cell, null);
			iv_price_reduce = (ImageView) view
					.findViewById(R.id.iv_price_reduce);
			iv_price_plus = (ImageView) view.findViewById(R.id.iv_price_plus);

			iv_price_reduce.setOnClickListener(new View.OnClickListener() {

				public void onClick(View arg0) {
					tv_price = (TextView) view.findViewById(R.id.tv_price);
					tv_price.setText(price.toString());
					price--;
					tv_price.setText(price + ".0");
				}
			});
			iv_price_plus.setOnClickListener(new View.OnClickListener() {

				public void onClick(View arg0) {
					tv_price = (TextView) view.findViewById(R.id.tv_price);
					tv_price.setText(price.toString());
					price++;
					tv_price.setText(price + ".0");
				}
			});

			return view;
		}
	}
}
